<?php
	include_once 'autoload.php';
	

	session_start();

	$ctl = new JobeditCtl();
	$ctl->checkLogged();
	$ctl->checkNotReadonly();
	$ctl->proceed();
	
	$header = new Header();
	$header->render('Job Update');
	
	// getting the form and proceed
	$form = $ctl->getJobeditForm();
	
	$id = $form->getId();
	$name = $form->getName();
	$status = $form->getStatus();
	$adding = $form->isAdding() ? 'yes' : '';
	$addingTitle = $form->isAdding() ? 'Add' : 'Edit';
	
	$list = $form->getStatusList();
	$combo = HtmlUtil::getRegularCombo('status', $list, $status);
?>
<form method="post">
<input type="hidden" name="pagename" value="jobedit" id="pgid">
<input type="hidden" name="metname" value="" id="metid">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="hidden" name="adding" value="<?php echo $adding; ?>">

<h2><?php echo $addingTitle; ?> Job </h2>
<table cellpadding="4" cellspacing="0" class="list">
  <tr>
    <td>Name:</td>
    <td><input type="text" name="name" value="<?php echo $name; ?>"></td>
    </tr>
  <tr>
    <td>Status:</td>
    <td><?php echo $combo; ?></td>
    </tr>
</table>

<p>
  <input type="button" value="Save" onclick="triggerform('save');">
  <input type="button" value="Cancel" onclick="triggerform('cancel');">
</p>
</form>
<?php
	$footer = new Footer();
	$footer->render();
?>
